Component({
  data: {
    selected: 0,
    borderStyle: "white",
    selectedColor: "#F11414",
    color: "#6c757d",
    list: [{
      "pagePath": "/pages/index/index",
      "text": "首页",
      "iconPath": "./../assets/tabbar/home.png",
      "selectedIconPath": "./../assets/tabbar/home_sel.png"
    }, {
      "pagePath": "/pages/user/user",
      "text": "用户",
      "iconPath": "./../assets/tabbar/user.png",
      "selectedIconPath": "./../assets/tabbar/user_sel.png"
    }],
    centerBtn: {
      "pagePath": "/pages/camara/camara",
      "text": "扫一扫",
      "iconPath": "./../assets/tabbar/scan-ai.png",
    }
  },
  attached() {},
  methods: {
    switchTab(e) {

      let index = e.currentTarget.dataset.index
      let item = this.data.list[index]

      let url = item.pagePath
      this.setData({
        selected: index
      })
      wx.switchTab({
        url: url
      })


    },
    navigateToCenterPage() {
      const url = this.data.centerBtn.pagePath
      wx.navigateTo({
        url: url,
      })
    }
  }
})